#! python3
# 多线程

import threading
import datetime
import time


def func1():
    dtNow = datetime.datetime.now()
    delta = datetime.timedelta(seconds=10)
    i = 1
    while datetime.datetime.now() < (dtNow + delta):
        time.sleep(3)
        print('func1唤醒次数：', i)
        i += 1


if __name__ == '__main__':
    print('Start of program.')

    threadObj = threading.Thread(target=func1)
    threadObj.start()

    # 传递参数
    # 常规参数作为一个列表，传递给 args 关键字
    # 关键字参数作为一个字典，传递给 kwargs 关键字
    threadObj = threading.Thread(target=print, args=['Cats', 'Dogs', 'Frogs'], kwargs={'sep': '& '})
    threadObj.start()

    print("End of program.")
